package com.huluobo.a2204parkdemo.adapter

import android.util.Log
import com.blankj.utilcode.util.TimeUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.huluobo.a2204parkdemo.R
import com.huluobo.base.bean.ParkingBeanItem
import java.text.SimpleDateFormat

/**
 *  Created by LC on 2024/8/22.
 */
class ParkingAdapter : BaseQuickAdapter<ParkingBeanItem, BaseViewHolder>(R.layout.item_parking) {
    override fun convert(helper: BaseViewHolder, item: ParkingBeanItem) {
        helper.setText(R.id.item_parking_id_iv, "车位id:${item.parkId}")
        helper.setText(R.id.item_parking_name_tv, "车位名称:${item.parkName}")
        if (item.parkTime.first() == '1') {
            val tampTime = TimeUtils.millis2String(item.parkTime.toLong(), SimpleDateFormat("MM-dd"))
            helper.setText(R.id.item_parking_time_tv, "车位时间:${tampTime}")
        } else {
            helper.setText(R.id.item_parking_time_tv, "车位时间:${item.parkTime}")
        }
    }
}